// 页面布局
$card-header-height: 200px !default;
$card-toolbar-height: 64px !default;
$header-height: 120px !default;

$card-header-height-without-toolbar: $card-header-height - $card-toolbar-height;

.page-layout {
    position: relative;
    overflow: hidden;

    &.card {
        display: flex;
        flex-direction: column;
        flex: 1 0 auto;
        width: 100%;
        min-width: 100%;


        &.header-bg::before {
            content: '';
            display: block;
            position: absolute;
            z-index: 1;
            top: 0;
            right: 0;
            left: 0;
            height: $card-header-height;
            background-color: mat-color($accent);
        }

        &.fullwidth {

            > .center {
                display: flex;
                flex-direction: column;
                flex: 1 0 auto;
                position: relative;
                z-index: 2;
                padding: 0 30px;
                width: 100%;
                min-width: 0;
                max-width: 100%;
                height: 100%;
                max-height: 100%;

                > .header {
                    height: $card-header-height-without-toolbar !important;
                    min-height: $card-header-height-without-toolbar !important;
                    max-height: $card-header-height-without-toolbar !important;
                }

                > .content-card {
                    display: flex;
                    flex-direction: column;
                    flex: 1 0 auto;
                    overflow: hidden;
                    @include mat-elevation(1);

                    > .toolbar {
                        display: flex;
                        justify-content: flex-start;
                        align-items: center;
                        border-bottom: 1px solid;
                        height: $card-toolbar-height;
                        min-height: $card-toolbar-height;
                        max-height: $card-toolbar-height;
                    }

                    > .content {
                        flex: 1 0 auto;
                    }
                }
            }

            // table
            &.table {

                > .center {
                    width: 100%;
                    min-width: 0;

                    > .header {
                        flex: 1 1 auto;
                    }

                    > .content-card {

                        > .content {
                            display: flex;

                            > .mat-tab-group {
                                overflow: hidden;

                                .mat-tab-header {

                                    .mat-tab-label {
                                        height: 64px;
                                    }
                                }

                                .mat-tab-body {
                                    overflow: hidden;

                                    .mat-tab-body-content {
                                        overflow: hidden;

                                        .tab-content {
                                            position: relative;
                                            width: 100%;
                                            height: 100%;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // Inner scroll
            &.inner-scroll {
                flex: 1 1 auto;

                > .center {
                    flex: 1 1 auto;

                    > .content-card {
                        flex: 1 1 auto;

                        > .content {
                            flex: 1 1 auto;
                            overflow: auto;
                            -webkit-overflow-scrolling: touch;
                        }
                    }
                }

                // table
                &.table {

                    > .center {

                        > .content-card {

                            > .content {

                                > .mat-tab-group {

                                    .mat-tab-body {

                                        .mat-tab-body-content {

                                            .tab-content {
                                                overflow: auto;
                                                -webkit-overflow-scrolling: touch;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        &:not(.fullwidth) {
            &>.header {
                margin-left: 30px;
            }
            &>.content {
                margin: 0 30px 30px 30px;
            }
        }
    }

    &.simple {
        display: flex;
        flex-direction: column;
        flex: 1 0 auto;
        width: 100%;
        min-width: 100%;

        &.fullwidth {

            > .content {
                flex: 1 1 auto;
                min-width: 0;
            }
        }

        &.fullwidth,
        &.inner-sidebar {

            > .header {
                height: $header-height;
                min-height: $header-height;
                max-height: $header-height;
            }
        }

        &.table {
            min-height: 100%;

            > .header {
                height: $header-height;
                min-height: $header-height;
                max-height: $header-height;
            }

            > .content {

                > .mat-tab-group {

                    .mat-tab-labels {
                        padding: 0 24px;
                    }
                }
            }
        }
    }

    // Blank layout
    &.blank {
        width: 100%;
        min-height: 100%;
    }

    @include media-breakpoint('xs') {

        // Smaller margins
        &.card {

            &.fullwidth {

                > .center {
                    padding: 0 15px;
                }
            }

            &:not(.fullwidth) {

                > .content {
                    margin: 15px;
                }
            }

        }
    }
}
